Skip to content

Conversation

@Yue-Zhengyuan
Copy link
Member

This PR adds a specialized routine of belief propagation for bipartite iPEPS/iPEPO (2 x 2 unit cell with only 2 independent tensors). Accordingly, for simple update and belief propagation gauging, they now will check if the input state (and the BPEnv) is exactly bipartite, and if so, automatically use a specialized routine to exactly preserve the bipartite-ness.

The ultimate solution is tiledarray, but for now we don't have better choices.

@codecov
Copy link

codecov bot commented Jan 11, 2026

Codecov Report

❌ Patch coverage is 98.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/algorithms/bp/gaugefix.jl 91.66% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/algorithms/bp/beliefpropagation.jl 95.58% <100.00%> (+1.35%) ⬆️
src/algorithms/time_evolution/gaugefix_su.jl 90.32% <100.00%> (ø)
src/algorithms/time_evolution/simpleupdate.jl 97.70% <ø> (ø)
src/algorithms/time_evolution/time_evolve.jl 95.45% <100.00%> (+4.54%) ⬆️
src/algorithms/bp/gaugefix.jl 96.59% <91.66%> (-0.78%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

return X, Xinv
end
if bipartite
# copy 1st column to 2nd column to eliminate differences
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried not to do the useless update of the 2nd column before copying from the 1st column. But then constinferred of gauge_fix is broken.

@Yue-Zhengyuan Yue-Zhengyuan requested a review from lkdvos January 15, 2026 15:52
Copy link
Member

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realize I never posted this comment. Do you feel like this would make sense, or is it not really too relevant?

normalize!(M)
alg.project_hermitian && (M = project_hermitian!!(M))
return M
if alg.bipartite
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's not easier to follow if we just write this out manually, calling similar and writing out the coordinates like that.
It probably doesn't matter all that much but I'd like to avoid the double map call, which allocates twice

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance suggestions are always welcome :) But this way, if we want to differentiate through BP, I guess we must use Mooncake/Enzyme (with mutation support)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good point! I guess already the normalize! call might be a problem, but then maybe it's just fine to merge as is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants